﻿using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Data;
using System.Xml.Serialization;

namespace NursingFormSystem
{
    /// <summary>
    /// 测量点的值
    /// </summary>
    [Serializable]
    [System.Runtime.InteropServices.ComVisible(false)]
    public class  FooterMeasure
    {
        /// <summary>
        /// 初始化对象
        /// </summary>
        public FooterMeasure()
        {
        }

        private string _RecordID = null;
        /// <summary>
        /// 记录编号
        /// </summary>
        [DefaultValue( null )]
        public string RecordID
        {
            get
            {
                return _RecordID; 
            }
            set
            {
                _RecordID = value; 
            }
        }

        private string _FBreath = null;
        /// <summary>
        /// 呼吸
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("FBreath")]
        public string FBreath
        {
            get
            {
                return _FBreath;
            }
            set
            {
                _FBreath = value;
            }
        }

        private string _CustomBreath = null;
        /// <summary>
        /// 是否显示显示底部呼吸位置
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("CustomBreath")]
        public string CustomBreath
        {
            get
            {
                return _CustomBreath;
            }
            set
            {
                _CustomBreath = value;
            }
        }

        private string _Pee = null;
        /// <summary>
        /// 小便/尿量(ml)
        /// </summary>
        [DefaultValue( null )]
        [XmlElement("Pee")]
        public string Pee
        {
            get
            {
                return _Pee; 
            }
            set
            {
                _Pee = value; 
            }
        }

        private string _LedTraffic = null;
        /// <summary>
        /// 引流量
        /// </summary>
        [DefaultValue( null )]
        [XmlElement("LedTraffic")]
        public string LedTraffic
        {
            get
            {
                return _LedTraffic; 
            }
            set
            {
                _LedTraffic = value; 
            }
        }

        private string _Others = null;
        /// <summary>
        /// 其他
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("Others")]
        public string Others
        {
            get
            {
                return _Others;
            }
            set
            {
                _Others = value;
            }
        }

        private string _Stool = null;
        /// <summary>
        /// 大便次数
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("Stool")]
        public string Stool
        {
            get
            {
                return _Stool;
            }
            set
            {
                _Stool = value;
            }
        }

        private string _Liquid_In = null;
        /// <summary>
        /// 液体进量
        /// </summary>
        [DefaultValue( null )]
        [XmlElement("Liquid_In")]
        public string Liquid_In
        {
            get { return _Liquid_In; }
            set { _Liquid_In = value; }
        }

        private string _Liquid_Out = null;
        /// <summary>
        /// 液体出量
        /// </summary>
        [DefaultValue( null )]
        [XmlElement("Liquid_Out")]
        public string Liquid_Out
        {
            get { return _Liquid_Out; }
            set { _Liquid_Out = value; }
        }

        private string _Blood_Pressure = null;
        /// <summary>
        /// 血压
        /// </summary>
        [DefaultValue( null )]
        [XmlElement("Blood_Pressure")]
        public string Blood_Pressure
        {
            get { return _Blood_Pressure; }
            set { _Blood_Pressure = value; }
        }

        private string _Weight = null;
        /// <summary>
        /// 体重
        /// </summary>
        [DefaultValue( null )]
        [XmlElement("Weight")]
        public string Weight
        {
            get { return _Weight; }
            set { _Weight = value; }
        }

        private string _Height = null;
        /// <summary>
        /// 身高
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("Height")]
        public string Height
        {
            get { return _Height; }
            set { _Height = value; }
        }

        private string _WeightAndHeight = null;
        /// <summary>
        /// 体重/身高
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("WeightAndHeight")]
        public string WeightAndHeight
        {
            get { return _WeightAndHeight; }
            set { _WeightAndHeight = value; }
        }

        private string _In_Take = null;
        /// <summary>
        /// 摄入量
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("In_Take")]
        public string In_Take
        {
            get { return _In_Take; }
            set { _In_Take = value; }
        }

        private string _Input = null;
        /// <summary>
        /// 输入量
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("Input")]
        public string Input
        {
            get { return _Input; }
            set { _Input = value; }
        }


        private string _Skin_Test = null;
        /// <summary>
        /// 皮试结果
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("Skin_Test")]
        public string Skin_Test
        {
            get { return _Skin_Test; }
            set { _Skin_Test = value; }
        }


        private string _DrugAllergy = null;
        /// <summary>
        /// 药物过敏
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("DrugAllergy")]
        public string DrugAllergy
        {
            get { return _DrugAllergy; }
            set { _DrugAllergy = value; }
        }

        private string _Blank_Line = null;
        /// <summary>
        /// 空行
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("Blank_Line")]
        public string Blank_Line
        {
            get { return _Blank_Line; }
            set { _Blank_Line = value; }
        }

        private string _Abdomen_Circumference = null;
        /// <summary>
        /// 腹围
        /// </summary>
        [DefaultValue( null )]
        [XmlElement("Abdomen_Circumference")]
        public string Abdomen_Circumference
        {
            get { return _Abdomen_Circumference; }
            set { _Abdomen_Circumference = value; }
        }
        private string _DrugSensitivityTest = null;
        /// <summary>
        /// 药敏试验
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("DrugSensitivityTest")]
        public string DrugSensitivityTest
        {
            get { return _DrugSensitivityTest; }
            set { _DrugSensitivityTest = value; }
        }

        private string _FeedMode = null;
        /// <summary>
        /// 喂养方式
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("FeedMode")]
        public string FeedMode
        {
            get { return _FeedMode; }
            set { _FeedMode = value; }
        }

        private string _MilkIntake = null;
        /// <summary>
        /// 进奶次数
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("MilkIntake")]
        public string MilkIntake
        {
            get { return _MilkIntake; }
            set { _MilkIntake = value; }
        }

        private string _VomitAmout = null;
        /// <summary>
        /// 呕吐
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("VomitAmout")]
        public string VomitAmout
        {
            get { return _VomitAmout; }
            set { _VomitAmout = value; }
        }

        private string _UrineTimes = null;
        /// <summary>
        /// 尿次
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("UrineTimes")]
        public string UrineTimes
        {
            get { return _UrineTimes; }
            set { _UrineTimes = value; }
        }

        private string _StoolCharacter = null;
        /// <summary>
        /// 大便性状
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("StoolCharacter")]
        public string StoolCharacter
        {
            get { return _StoolCharacter; }
            set { _StoolCharacter = value; }
        }

        private string _StoolTimes = null;
        /// <summary>
        /// 大便次数
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("StoolTimes")]
        public string StoolTimes
        {
            get { return _StoolTimes; }
            set { _StoolTimes = value; }
        }

        private string _BabyWeight = null;
        /// <summary>
        /// 婴儿体重
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("BabyWeight")]
        public string BabyWeight
        {
            get { return _BabyWeight; }
            set { _BabyWeight = value; }
        }

        //以下为应急处理  后期FooterMeasure、Measure应通过反序列化动态生成
        private string _Blank_Line1 = null;
        /// <summary>
        /// 空行1
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("Blank_Line1")]
        public string Blank_Line1
        {
            get { return _Blank_Line1; }
            set { _Blank_Line1 = value; }
        }
        private string _Blank_Line2 = null;
        /// <summary>
        /// 空行2
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("Blank_Line2")]
        public string Blank_Line2
        {
            get { return _Blank_Line2; }
            set { _Blank_Line2 = value; }
        }
        private string _Blank_Line3 = null;
        /// <summary>
        /// 空行3
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("Blank_Line3")]
        public string Blank_Line3
        {
            get { return _Blank_Line3; }
            set { _Blank_Line3 = value; }
        }
        private string _Blank_Line4 = null;
        /// <summary>
        /// 空行4
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("Blank_Line4")]
        public string Blank_Line4
        {
            get { return _Blank_Line4; }
            set { _Blank_Line4 = value; }
        }
        private string _Blank_Line5 = null;
        /// <summary>
        /// 空行5
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("Blank_Line5")]
        public string Blank_Line5
        {
            get { return _Blank_Line5; }
            set { _Blank_Line5 = value; }
        }
        private string _Blank_Line6 = null;
        /// <summary>
        /// 空行6
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("Blank_Line6")]
        public string Blank_Line6
        {
            get { return _Blank_Line6; }
            set { _Blank_Line6 = value; }
        }
        private string _Blank_Line7 = null;
        /// <summary>
        /// 空行7
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("Blank_Line7")]
        public string Blank_Line7
        {
            get { return _Blank_Line7; }
            set { _Blank_Line7 = value; }
        }
        private string _Blank_Line8 = null;
        /// <summary>
        /// 空行8
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("Blank_Line8")]
        public string Blank_Line8
        {
            get { return _Blank_Line8; }
            set { _Blank_Line8 = value; }
        }
        private string _Blank_Line9 = null;
        /// <summary>
        /// 空行9
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("Blank_Line9")]
        public string Blank_Line9
        {
            get { return _Blank_Line9; }
            set { _Blank_Line9 = value; }
        }
        private string _Blank_Line10 = null;
        /// <summary>
        /// 空行10
        /// </summary>
        [DefaultValue(null)]
        [XmlElement("Blank_Line10")]
        public string Blank_Line10
        {
            get { return _Blank_Line10; }
            set { _Blank_Line10 = value; }
        }
        private DateTime _ValueDate = TemperatureDocument.NullDate;
        /// <summary>
        /// 测量日期
        /// </summary>
        [DefaultValue( typeof( DateTime ) , TemperatureDocument.NullDateString )]
        [XmlElement("ValueDate")]
        public DateTime ValueDate
        {
            get
            {
                return _ValueDate.Date ; 
            }
            set
            {
                _ValueDate = value.Date ; 
            }
        }

        private DataRowState _RecordState = DataRowState.Unchanged;
        /// <summary>
        /// 记录状态
        /// </summary>
        [Browsable( false )]
        [System.Xml.Serialization.XmlIgnore]
        public DataRowState RecordState
        {
            get { return _RecordState; }
            set { _RecordState = value; }
        }

        /// <summary>
        /// 设置默认值
        /// </summary>
        public void SetDefaultValue()
        {
            this._FBreath = "";
            this._Abdomen_Circumference = "";
            this._Blood_Pressure = "";
            this._Weight = "";
            this._Height = "";
            this._Liquid_In = "";
            this._Liquid_Out = "";
            this._Pee = "";
            this._Stool = "";
            this._WeightAndHeight = "";
            this._DrugAllergy = "";
            this._In_Take = "";
            this._Input = "";
            this._Skin_Test = "";
            this._LedTraffic = "";
            this._DrugSensitivityTest = "";
            this._Others = "";
            this._FeedMode = "";
            this._MilkIntake = "";
            this._VomitAmout = "";
            this._UrineTimes = "";
            this._StoolCharacter = "";
            this._StoolTimes = "";
            this._Blank_Line = "";
            this._Blank_Line1 = "";
            this._Blank_Line2 = "";
            this._Blank_Line3 = "";
            this._Blank_Line4 = "";
            this._Blank_Line5 = "";
            this._Blank_Line6 = "";
            this._Blank_Line7 = "";
            this._Blank_Line8 = "";
            this._Blank_Line9 = "";
            this._Blank_Line10 = "";
        }

        /// <summary>
        /// 复制对象
        /// </summary>
        /// <returns>复制品</returns>
        public FooterMeasure Clone()
        {
            return (FooterMeasure)this.MemberwiseClone();
        }
    }

    /// <summary>
    /// 数据记录列表
    /// </summary>
    /// <remarks></remarks>
    [System.Runtime.InteropServices.ComVisible(false)]
    public class FooterMeasureList : List<FooterMeasure>
    {
        /// <summary>
        /// 初始化对象
        /// </summary>
        public FooterMeasureList()
        {
        }

        /// <summary>
        /// 深度复制
        /// </summary>
        /// <returns>复制品</returns>
        public FooterMeasureList CloneDeeply()
        {
            FooterMeasureList list = new FooterMeasureList();
            foreach (FooterMeasure m in this)
            {
                list.Add(m.Clone());
            }
            return list;
        }
    }

    internal class CMeasureComparer :IComparer<FooterMeasure>
    {
        public int Compare(FooterMeasure x, FooterMeasure y)
        {
            return DateTime.Compare(x.ValueDate, y.ValueDate);
        }
    }
}
